package com.hmyd.hmyd_android.adapter;

import java.util.List;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * viewpager适配器
 * 继承自fragmentPagerAdapter 
 * FragmentStatePagerAdapter
 * 在这里考虑到页面较少，数据量不多，所以用前者，不考虑内存占用
 * @author wangk
 */
public class MyViewPagerAdapter extends FragmentPagerAdapter {
	
	private List<Fragment> fragments;

	public MyViewPagerAdapter(FragmentManager fm,List<Fragment> fragments) {
		super(fm);
		this.fragments = fragments;
	}

	@Override
	public int getCount() {
		return fragments.size();
	}

	@Override
	public Fragment getItem(int arg0) {
		return fragments.get(arg0%fragments.size());
	}
	
	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}
}
